<template>
  <el-card shadow="never" class="aui-card--fill">
    <el-table :data="dataList" border v-loading="dataListLoading" @selection-change="selectionChangeHandle"
      style="width: 100%;">
      <el-table-column prop="teaName" header-align="center" align="center" label="指导老师">
      </el-table-column>
      <el-table-column prop="teaname1" header-align="center" align="center" label="答辩老师1">
      </el-table-column>
      <el-table-column prop="teaname2" header-align="center" align="center" label="答辩老师2">
      </el-table-column>
      <el-table-column prop="teaname3" header-align="center" align="center" label="答辩老师3">
      </el-table-column>
      <el-table-column prop="teaname4" header-align="center" align="center" label="答辩老师4">
      </el-table-column>
      <el-table-column prop="starttime" width="180" header-align="center" align="center" label="答辩时间">
      </el-table-column>
      <el-table-column prop="place" header-align="center" align="center" label="答辩教室">
      </el-table-column>
    </el-table>
    <el-pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]" :page-size="pageSize" :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
  </el-card>
</template>

<script>
import servicesApi from '@/services/servicesApi';
export default {
  data() {
    return {
      SearchForm: {
        tusername: ''
      },
      dataList: [
        { 
         teaName: 'dg',
         teaname1: 'fgh',
         teaname2: 'ghn',
         teaname3: 'h', 
         teaname4: 'fh',
         starttime: 'fh',
         place: 'f'
         }
      ],
      pageIndex: 1,
      pageSize: 10,
      totalPage: 0,
      dataListLoading: false,
    }
  },
  activated() {
    this.getDataList()
  },
  created() {
    this.getDataList()
  },
  methods: {
    // 获取数据列表
    getDataList() {
      this.dataListLoading = true
      let pageInfo = {
        current: this.pageIndex,
        size: this.pageSize,
        name: this.SearchForm.tusername
      }
      servicesApi.teafindarrangeApi(pageInfo).then(res => {
        // console.log(res.data)
        let code =res.data.code
        let data = res.data.data
        if (code===200) {
          this.dataList = data.records
          this.totalPage = data.total
        } else {
          this.dataList = []
          this.totalPage = 0
        }
        this.dataListLoading = false
      })
    },
    // 每页数
    sizeChangeHandle(val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle(val) {
      this.pageIndex = val
      this.getDataList()
    },
    // 多选
    selectionChangeHandle(val) {
      this.dataListSelections = val
    },
  }
}
</script>
